class Solution
{
public:
    bool increasingTriplet(vector<int> &nums)
    {
        int n = nums.size();
        if (n < 3)
        {
            return false;
        }
        long long first = nums[0];
        long long second = 1LL + INT_MAX;
        for (int i = 1; i < n; ++i)
        {
            if (nums[i] > second)
            {
                return true;
            }
            else if (nums[i] > first)
            {
                second = nums[i];
            }
            else
            {
                first = nums[i];
            }
        }
        return false;
    }
};